Add BallTree from petal-neighbors for nearest neighbor search (Resolves #1)#34
Open
octoaide[bot] wants to merge 1 commit into
Open
Add BallTree from petal-neighbors for nearest neighbor search (Resolves #1)#34octoaide[bot] wants to merge 1 commit into
BallTree from petal-neighbors for nearest neighbor search (Resolves #1)#34octoaide[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the
BallTreedata structure frompetal-neighborsas requested in issue #1, providing efficient nearest neighbor search capabilities to thepypetalproject.Closes #1
Summary
I've implemented the
BallTreedata structure frompetal-neighbors0.18.0 for the pypetal project. Here are the changes:Files Modified
Cargo.toml - Added
petal-neighbors = "0.18"dependency and renamed the library fromdecompositiontopypetalto serve as the main modulesrc/lib.rs - Updated to expose both
decompositionandneighborssubmodules through the mainpypetalPython modulesrc/decomposition.rs - Made the
decompositionfunction public for use from lib.rssetup.py - Updated to use
pypetal.pypetalas the Rust extension nameFiles Created
BallTreewrapper with:BallTree(points)- Creates a ball tree from a 2D numpy array using Euclidean distancen_samples,n_nodesquery_nearest(point)- Returns the nearest neighbor index and distancequery(point, k)- Returns k nearest neighbor indices and distancesquery_radius(point, radius)- Returns all neighbor indices within the given radiusPython Usage Example
All tests pass and clippy reports no warnings.